package fr.umlv.m2.jee.spij.service.registration;

import fr.umlv.m2.jee.spij.service.ldap.authentification.DisplayActor;
import fr.umlv.m2.jee.spij.service.unit.DisplayUnit;
import org.springframework.binding.message.MessageContext;

import java.util.List;

/**
 * Provides methods to retrieve registrations into databases from DAO.
 * @author lounes
 * @author Aurelien
 */
public interface IDisplayRegistrationService {
	
	/**
	 * Returns all the registrations which are inside the database.
	 * @param currentUser
	 * @param context
	 * @return list of DTO registration
	 */
    public List<DisplayRegistration> getAllDisplayRegistrationForUser(DisplayActor currentUser, MessageContext context);
    /**
     * Removes from database the registration given by its id provided in argument.
     * @param id
     * @param context
     * @return true whether the registration has been removed correctly, false otherwise.
     */
    public boolean deleteRegistrationById(long id, MessageContext context);
    /**
     * Persists into database as a registration the data provided.
     * @param createdRegistration
     * @param student
     * @param trainingName
     * @param context
     * @return  true whether the registration has been persisted correctly, false otherwise.
     */
    public boolean createRegistration(DisplayRegistration createdRegistration,
                                      String student, String trainingName, MessageContext context);

    public DisplayRegistration updateUnitList(DisplayRegistration createdRegistration,
                                              String courseName);
    /**
     * Returns all the units by course name which are inside the database.
     * @param courseName
     * @param context
     * @return list of DTO unit
     */
    public List<DisplayUnit> getAllDisplayUnitByCourse(String courseName,
                                                       MessageContext context);
    /**
     * validate a registration with the data provided into validate the DTO registration object.
     * @param registration
     * @param context
     * @return true whether the registration has been updated correctly, false otherwise.
     */
    public boolean validateRegistration(DisplayRegistration registration, MessageContext context);
    /**
     * Returns all the units for student which are inside the database.
     * @param registration
     * @param context
     * @return list of DTO unit
     */
    public List<DisplayUnit> getAllDisplayUnitForStudent(
            DisplayRegistration registration, MessageContext context);
    /**
     * Returns all the optional units by course which are inside the database.
     * @param courseName
     * @param context
     * @return list of DTO unit
     */ 
    List<DisplayUnit> getAllDisplayOptionalUnitByCourse(String courseName,
                                                        MessageContext context);

}
